﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace UniversitySolution
{
    class Group
    {
        public string name;
        public List<Student> students = new List<Student>();

        public static int groupCount;

        public static Group GenerateRandomGroup()
        {
            groupCount++;
            Group group = new Group();
            group.name = "Group" + groupCount;

            for (int i = 0; i < 5; i++)
            {
                Student student = Student.GenerateRandomStudent();
                group.students.Add(student);
            }
            return group;
        }
        public void PrintGroupToConsole()
        {
            Console.WriteLine("*******************");
            Console.WriteLine("Group: {0}", name);
            foreach (var student in students)
            {
                student.PrintStudentInfoToConsole();
                Console.WriteLine();
            }
        }

        public void PringByAveragemark()
        {
            Console.WriteLine("*******************");
            Console.WriteLine("Group: {0}", name);
            foreach (var student in students)
            {
                if (student.CalculateAvgMark() > 50)
                {
                    student.PrintStudentInfoToConsole();
                    Console.WriteLine("Averege mark: {0}", student.CalculateAvgMark());
                }
            }
        }
        
    }
}
